package me.yushuai.wukong.base.repository;

import me.yushuai.wukong.base.entity.ZoneGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 针对表【BAS_ZONE_GROUP】的数据库操作Mapper
 *
 * @author zhoushuai@189.cn
 * @since 2022-08-31 09:32:51
 */
@Repository
public interface ZoneGroupRepository extends JpaRepository<ZoneGroup, Long>, JpaSpecificationExecutor<ZoneGroup> {

    @Query("from ZoneGroup where bizId = ?1")
    Boolean existsByBizId(String bizId);

    @Query("from ZoneGroup  where zoneGroupId = ?1 and bizId = ?2")
    Boolean existsByZoneGroupIdAndBizId(Long zoneGroupId, String bizId);


    @Query("from ZoneGroup where bizId = ?1")
    Optional<ZoneGroup> findByBizId(String bizId);
}




